/**
 * @ author: 汪孟苹
 */
define([],function(){
	var tpl = {};

	tpl.init = function(){
		var html = '';
		html += taskBabycard();
		return html;
	}
	tpl.init2 = function(){
		var html = '';
		html += showContainer();
		return html;
	}
	tpl.init3 = function(){
		var html = '';
		html += followUpTit();
		return html;
	}
	tpl.followupInit = function(){
		var html = '';
		html += followUp();
		html += followupInfo();
		html += collectFlag();
		html += recordGroup();
		return html;
	}
	tpl.printInit = function(){
		var html = '';
		html += print();
		return html;
	}
	tpl.anchorMenuInit = function(){
		var html = '';
		html += anchorMenu();
		return html;
	}

	var taskBabycard = function(){
		return 	'<script id="tpl_outPatient_taskBabycard" type="text/html">'+
				'	<div class="row task-babycard">'+
				'		<div class="col-sm-2 col-md-2 task-babycard-icon">'+
				'			<img src="{{imgSrc}}">'+
				'		</div>'+
				'		<div class="col-sm-10 col-md-10" style="padding-right: 0;">'+
				'			<div class="task-babycard-name ellipsis-1">{{patientName}}</div>'+
				'			<div class="task-babycard-queuename ellipsis-1">{{queuename}}</div>'+
				'		</div>'+
				'	</div>'+
				'</script>';
	}
	var showContainer = function(){
		return 	'<script id="tpl_outPatient_showContainer" type="text/html">'+
				'	<div class="show-wrapper clearfix">'+
				'		{{each rows as value i}}'+
				'		<div class="row {{if value.currentTaskFlag}} active{{/if}}" seqno="{{value.seqNo}}" taskstatus="{{value.taskStatus}}" taskid="{{value.taskId}}" preTaskId="{{value.preTaskId}}">'+
				'			<div class="col-sm-12 col-md-12 task-tit" taskStatus="{{value.taskStatus}}">'+
				'				{{value.taskName}}'+
				'				{{if value.taskStatus== "1"}}'+
				'				<i class="fa fa-check-square-o"></i>'+
				'				{{else if value.taskStatus== "2"}}'+
				'				<i class="fa fa-info-circle"></i>'+
				'				{{else if value.currentTaskFlag}}'+
				'				<i class="fa fa-clock-o"></i>'+
				'				{{/if}}'+
				'			</div>'+
				'			<div class="col-sm-12 col-md-12 task-time">'+
				'				<span class="taskDate">{{value.taskDate}}</span>'+
				'				{{if value.seqNo!=0}}'+
				'				<span>(±{{value.taskWindowDay}}天)</span>'+
				'				{{/if}}'+
				'			</div>'+
				'		</div>'+
				'		{{/each}}'+
				'	</div>'+
				'</script>';
	}
	var followUpTit = function(){
		return  '<script id="tpl_outPatient_followUpTit" type="text/html">'+
				'	<div class="row">'+
				// '		<div class="tag">BBcare-专业的随访平台</div>'+
				'		<div class="col-sm-12 col-md-12 tit">{{queueName}}</div>'+
				'	</div>'+
				'</script>';
	}
	// 随访问卷
	var followUp = function(){
		return  '<script id="tpl_outPatient_followUp" type="text/html">'+
				'<div class="form-horizontal" {{if ptTaskId}}id="{{ptTaskId}}"{{/if}} {{if queueId}}id="{{queueId}}"{{/if}}>'+
				'	{{if flagQuestions}}'+
				'	{{if task && task.seqNo != 0}}'+
				'	<div class="clearfix">'+
				'		{{include "tpl_outPatient_followupInfo",task}}'+
				'	</div>'+
				'	{{/if}}'+
				'	{{/if}}'+

				'	{{if flagQuestions}}'+
				'	<div id="questions" class="clearfix"></div>'+
				'	{{/if}}'+

				'	{{if task && task.seqNo != 0}}'+
				'	{{if sampleList}}'+
				'		{{include "tpl_outPatient_collectFlag",sampleList}}'+
				'	{{/if}}'+
				'	{{/if}}'+

				'	{{if flagQuestions}}'+
				'	{{if task && task.seqNo != 0}}'+
				'	{{if flagTaskGuide}}'+
				'	<div class="clearfix">'+
				'		{{include "tpl_outPatient_recordGroup",task}}'+
				'	</div>'+
				'	{{/if}}'+
				'	{{/if}}'+
				'	{{/if}}'+
				'</div>'+
				'</script>';
	}
	// 安医大采集
	var collectFlag = function(){
		return 	'<script id="tpl_outPatient_collectFlag" type="text/html">'+
				'	{{if flag}}'+	// flag：安医大为true，其他为false
				'		<div class="qaCard-subtit col-sm-12 col-md-12">'+
				'			<div>生物样本收集记录</div>'+
				'		</div>'+
				'		{{each sampleList as value i}}'+
				'		<div class="qaCard form-group form-group-sm col-sm-4 col-md-4 grid-label-6">'+
				'			<label class="control-label">{{value.label}}</label>'+
				'   		<div class="control-input">'+
				'				{{if value.status=="default"}}'+
				'					<select class="form-control" name="{{value.name}}">'+
				'						{{each value.list as item i}}'+
				'   						<option value={{item.key}} {{if value.val == item.key}} selected="selected" {{/if}}>{{item.value}}</option>'+
				'						{{/each}}'+
				'					</select>'+
				'				{{else if value.status=="readonly"}}'+
				'					<p class="form-control-static" name="{{value.name}}">'+
				'						{{each value.list as item i}}'+
				'   						{{if value.val == item.key}}{{item.value}}{{/if}}'+
				'						{{/each}}'+
				'					</p>'+
				'				{{else if value.status=="disabled"}}'+
				'					<select class="form-control" name="{{value.name}}" disabled>'+
				'						{{each value.list as item i}}'+
				'   						<option value={{item.key}} {{if value.val == item.key}} selected="selected" {{/if}}>{{item.value}}</option>'+
				'						{{/each}}'+
				'					</select>'+
				'				{{/if}}'+
				'			</div>'+
				'		</div>'+
				'		{{/each}}'+
				'	{{/if}}'+
				'</script>';
	}
	// 随访指导
	var followupInfo = function(){
		return 	'<script id="tpl_outPatient_followupInfo" type="text/html">'+
				'	<div class="qaCard-subtit col-sm-12 col-md-12">'+
				'		<div>随访信息</div>'+
				'	</div>'+
				'	<div class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-6">'+
				'		<label class="control-label"><i class="not-null">*</i>随访日期</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'   			<input type="date" class="form-control" name="finishDate" value="{{finishDate}}" placeholder="{{placeHolder}}">'+
				'			{{else if status=="readonly"}}'+
				'				<p class="form-control-static" name="finishDate">{{finishDate}}</p>'+
				'			{{else if status=="disabled"}}'+
				'   			<input type="date" class="form-control" name="finishDate" value="{{finishDate}}" placeholder="{{placeHolder}}" disabled>'+
				'			{{/if}}'+
				'  		</div>'+
				'	</div>'+
				'	<div id="followupAge" birthday="{{ageRelate.birthday}}" expectedDay="{{ageRelate.expectedDay}}" pregnancyDay="{{ageRelate.pregnancyDay}}" class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-6">'+
				'		<label class="control-label">{{followupAgeLabel}}</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'				<p class="form-control-static" name="followupAge">{{followupAge}}</p>'+
				'			{{else if status=="readonly"}}'+
				'				<p class="form-control-static" name="followupAge">{{followupAge}}</p>'+
				'			{{else if status=="disabled"}}'+
				'   			<input type="text" class="form-control" name="followupAge" value="{{followupAge}}" disabled>'+
				'			{{/if}}'+
				'		</div>'+
				'	</div>'+
				'	{{if followupActualAge}}'+
				'	<div id="followupActualAge" birthday="{{ageRelate.birthday}}" expectedDay="{{ageRelate.expectedDay}}" pregnancyDay="{{ageRelate.pregnancyDay}}" class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-6">'+
				'		<label class="control-label">{{followupActualAgeLabel}}</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'				<p class="form-control-static" name="followupActualAge">{{followupActualAge}}</p>'+
				'			{{else if status=="readonly"}}'+
				'				<p class="form-control-static" name="followupActualAge">{{followupActualAge}}</p>'+
				'			{{else if status=="disabled"}}'+
				'   			<input type="text" class="form-control" name="followupActualAge" value="{{followupActualAge}}" disabled>'+
				'			{{/if}}'+
				'		</div>'+
				'	</div>'+
				'	{{/if}}'+
				'	<div class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-6">'+
				'		<label class="control-label">随访医生</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'				<p class="form-control-static" name="updateAuname">{{updateAuname}}</p>'+
				'			{{else if status=="readonly"}}'+
				'				<p class="form-control-static" name="updateAuname">{{updateAuname}}</p>'+
				'			{{else if status=="disabled"}}'+
				'   			<input type="text" class="form-control" name="updateAuname" value="{{updateAuname}}" disabled>'+
				'			{{/if}}'+
				'		</div>'+
				'	</div>'+
				'</script>';
	}
	// 随访信息
	var recordGroup = function(){
		return 	'<script id="tpl_outPatient_recordGroup" type="text/html">'+
				'	<div class="qaCard-subtit col-sm-12 col-md-12">'+
				'		<div>随访指导</div>'+
				'	</div>'+
				'	<div class="qaCard form-group form-group-sm col-sm-4 col-md-4 grid-label-6">'+
				'		<label class="control-label">下次随访时间</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'   			<input type="date" class="form-control" name="nextDate" min="{{finishDate}}" value="{{nextTime}}">'+
				'			{{else if status=="readonly"}}'+
				'				<p class="form-control-static" name="nextDate">{{nextTime}}</p>'+
				'			{{else if status=="disabled"}}'+
				'   			<input type="date" class="form-control" name="nextDate" min="{{finishDate}}" value="{{nextTime}}" disabled>'+
				'			{{/if}}'+
				'  		</div>'+
				'	</div>'+
				'	<div class="qaCard form-group form-group-sm col-sm-4 col-md-4 grid-label-6">'+
				'		<label class="control-label">下次随访地址</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'				<select class="form-control" name="nextAddress">'+
				'					{{each nextAddress as item i}}'+
				'   					<option>{{item}}</option>'+
				'					{{/each}}'+
				'				</select>'+
				'			{{else if status=="readonly"}}'+
				'				{{if nextAddress!=null&&nextAddress.length>0}}'+
				'					<p class="form-control-static" name="nextAddress">{{nextAddress[0]}}</p>'+
				'				{{else}}'+
				'					<p class="form-control-static">无</p>'+
				'				{{/if}}'+
				'			{{else if status=="disabled"}}'+
				'				<select class="form-control" name="nextAddress" disabled>'+
				'					{{each nextAddress as item i}}'+
				'   					<option>{{item}}</option>'+
				'					{{/each}}'+
				'				</select>'+
				'			{{/if}}'+
				'		</div>'+
				'	</div>'+
				'   <div style="clear:both;"></div>'+
				'	<div class="qaCard form-group form-group-sm col-sm-12 col-md-12 grid-label-6">'+
				'		<label class="control-label">随访备注</label>'+
				'   	<div class="control-input">'+
				'			{{if status=="default"}}'+
				'				<textarea class="form-control" rows="{{rows?rows:3}}" name="taskNote" placeholder="{{placeHolder}}">{{taskNote}}</textarea>'+
				'			{{else if status=="readonly"}}'+
				'				<p class="form-control-static form-control-static-textarea" name="taskNote">{{taskNote}}</p>'+
				'			{{else if status=="disabled"}}'+
				'				<textarea class="form-control" rows="{{rows?rows:3}}" name="taskNote" placeholder="{{placeHolder}}" disabled>{{taskNote}}</textarea>'+
				'			{{/if}}'+
				'  		</div>'+
				'	</div>'+
				'</script>';
	}
	// 打印
	var print = function(){
		return 	'<script id="tpl_outPatient_print" type="text/html">'+
				'<div class="print-left">'+
				'	<div>{{task.finishTime}}</div>'+
				'</div>'+
				'<div class="print-right">'+
				'	<div id="hospitalName" class="hospital-name">{{hospital.hospitalName}}</div>'+
				'	<div id="patientInfo" class="patient-info clearfix">'+
				'		<div>姓名：{{info.patientName}}</div>'+
				'		<div>性别：{{info.gender}}</div>'+
				'		<div>年龄：{{info.ageMonDayStr}}</div>'+
				'	</div>'+
				'	<div>'+
				'		{{each rows as value1 i}}'+
				'		{{each value1 as value2 i}}'+
				'		{{if value2.children}}'+
				'		<div class="print-item clearfix">'+
				'			<div class="print-item-tit">{{value2.label}}：</div>'+
				'			<div class="print-item-con">'+
				'				{{each value2.children as value3 i}}'+
				'					{{if value3}}'+
				'						{{if value3.children}}'+
				'							{{each value3.children as value4 i}}'+
				'								<span>{{value4.label}}：{{value4.val}}</span>'+
				'							{{/each}}'+
				'						{{else}}'+
				//'							{{if value3.val}}'+
				'							<span>{{value3.label}}：{{value3.val}}</span>'+
				//'							{{/if}}'+
				'						{{/if}}'+
				'					{{/if}}'+
				'				{{/each}}'+
				'			</div>'+
				'		</div>'+
				'		{{/if}}'+
				'		{{/each}}'+
				'		{{/each}}'+
				'	<div class="print-item clearfix">'+
				'		<div class="print-item-tit">随访指导：</div>'+
				'		<div class="print-item-con">'+
				'			{{if task.nextDateTime}}'+
				'			<span>下次随访时间：{{task.nextDateTime}}</span>'+
				'			{{/if}}'+
				'			<span>下次随访地址：{{task.nextAddress}}</span>'+
				'		</div>'+
				'	</div>'+
				'</div>'+
				'</script>';
	}
	// 锚点导航
	var anchorMenu = function(){
		return 	'<script id="tpl_outPatient_anchorMenu" type="text/html">'+
				'	 <div class="anchor-menu-fold">问卷导航</div>'+
	            '    <div class="anchor-menu-unfold">'+
	            '        <div class="anchor-menu-tit clearfix">'+
	            '            <span class="anchor-menu-close">关闭</span>'+
	            '            <span class="anchor-menu-name">问卷导航</span>'+
	            '        </div>'+
	            '        <div class="anchor-menu-list">'+
	            '            <ul>'+
	            '				{{each list as value i}}'+
	            '                <li {{if i==0}}class="active"{{/if}}><a class="ellipsis-1" href="#{{value.id}}">{{value.label}}</a></li>'+
	            '				{{/each}}'+
	            '            </ul>'+
	            '        </div>'+
	            '    </div>'+
				'</script>';
	}

	return tpl;
});
